package org.example.test;

/**
 * @Author : zhangbo
 * @data : 2024/12/23
 * @description :
 */
public class Planet {


    public static void main(String[] args) {
        Planet[] planets = {
                new Planet("Mercury", 0),
                new Planet("Venus", 0),
                new Planet("Earth", 1),
                new Planet("Mars", 2)
        };

        System.out.println("+++++++++");
        //数组---地址
        System.out.println(planets);
        System.out.println("+++++++++");
        //对象--地址
        System.out.println(planets[2]);
        System.out.println("+++++++++");
        //属性
        System.out.println(planets[2].moons);
        System.out.println("+++++++++");
    }

    public String name;
    public int moons;

    public Planet(String name, int moons) {
        this.name = name;
        this.moons = moons;
    }
}
